#
# @lc app=leetcode.cn id=830 lang=python
#
# [830] 较大分组的位置
#

# @lc code=start
class Solution(object):
    def largeGroupPositions(self, s):
        """
        :type s: str
        :rtype: List[List[int]]
        """
        res=[]
        index=None
        if len(s)<3:
          return []
        for i in range(1,len(s)):
            if s[i]==s[i-1]:
                if index is None:
                    index=i-1
            else:
                if index is not None and i-index>=3:
                    res.append([index,i-1])
                index=None
        if index is not None and len(s)-index>=3:
            res.append([index,len(s)-1])
        return res
# @lc code=end

